package com.beiding.mpTimer;

/**
 * Id生成的策略
 */
public interface IdCreateStrategy {


    /**
     * 根据主题和负载生成id.
     * <p>
     * 默认生成策略:default_id_creator_[负载的hash码]_负载的主题
     *
     * @param payload 负载
     * @param topic   主题
     * @return id
     */
    default String createId(Object payload, String topic) {
        return "default_id_creator_" + payload.hashCode() + "_" + topic;
    }

}
